package me.pplay.playtalk.util;

import java.util.Comparator;

import me.pplay.playtalk.bean.Chat;

public class ComparatorChat implements Comparator{

	@Override
	public int compare(Object arg0, Object arg1) {
		Chat chat0 = (Chat)arg0;
		Chat chat1 = (Chat)arg1;
		if(chat0 == null || chat1 == null)
			return 0;
		if(chat0.getTime() == null || chat1.getTime()==null)
			return 0;
		int flag = chat1.getTime().compareTo(chat0.getTime());
		if (flag == 0) {
			return chat1.getName().compareTo(chat0.getName());
		} else {
			return flag;
		}
	}

}
